/*    */ package server.maps;
/*    */ 
/*    */ import client.MapleCharacter;
/*    */ import client.MapleClient;
/*    */ import handling.world.WorldBroadcastService;
/*    */ import java.util.LinkedList;
/*    */ import java.util.List;
/*    */ import server.Timer;
/*    */ import tools.MaplePacketCreator;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class MapleTVEffect
/*    */ {
/*    */   private static boolean active;
/*    */   private final MapleCharacter user;
/*    */   private final int type;
/*    */   MapleClient c;
/* 25 */   private List<String> message = new LinkedList<>();
/* 26 */   private MapleCharacter partner = null;
/*    */   
/*    */   public MapleTVEffect(MapleCharacter User, MapleCharacter Partner, List<String> Msg, int Type) {
/* 29 */     this.message = Msg;
/* 30 */     this.user = User;
/* 31 */     this.type = Type;
/* 32 */     this.partner = Partner;
/*    */   }
/*    */   
/*    */   public static boolean isActive() {
/* 36 */     return active;
/*    */   }
/*    */   
/*    */   private void setActive(boolean set) {
/* 40 */     active = set;
/*    */   }
/*    */   
/*    */   public static int getDelayTime(int type) {
/* 44 */     switch (type) {
/*    */       case 0:
/*    */       case 3:
/* 47 */         return 15;
/*    */       case 1:
/*    */       case 4:
/* 50 */         return 30;
/*    */       case 2:
/*    */       case 5:
/* 53 */         return 60;
/*    */     } 
/* 55 */     return 0;
/*    */   }
/*    */   
/*    */   public void stratMapleTV() {
/* 59 */     broadCastTV(true);
/*    */   }
/*    */   
/*    */   private void broadCastTV(boolean isActive) {
/* 63 */     setActive(isActive);
/* 64 */     if (isActive) {
/* 65 */       int delay = getDelayTime(this.type);
/* 66 */       WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.enableTV());
/* 67 */       WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.sendTV(this.user, this.message, (this.type <= 2) ? this.type : (this.type - 3), this.partner, delay));
/*    */       
/* 69 */       Timer.WorldTimer.getInstance().schedule(() -> broadCastTV(false), (delay * 1000));
/*    */     } else {
/* 71 */       WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.removeTV());
/*    */     } 
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\server\maps\MapleTVEffect.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */